BIN=main
SRC=main.cpp
CC=g++
CGI=test_cgi
CURR=$(shell pwd)
FLAGS=-std=c++11 -lpthread

.PHONY:ALL
ALL:$(BIN) $(CGI)

$(BIN):$(SRC)
	$(CC) -o $@ $^ $(FLAGS)
$(CGI):$(CURR)/wwwroot/cgi/test_cgi.cc 
	$(CC) -o $@ $^

.PHONY:clean
clean:
	rm -rf $(BIN)
	rm -rf output

.PHONY:output
output:
	mkdir -p output
	cp $(BIN) output
	cp -rf wwwroot output
	cp $(CGI) output/wwwroot